package ihm;

import java.awt.EventQueue;
import java.awt.Font;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;

import javax.swing.ImageIcon;
import javax.swing.JButton;
import javax.swing.JFrame;
import javax.swing.JLabel;
import javax.swing.JOptionPane;
import javax.swing.JPanel;
import javax.swing.JTextField;
import javax.swing.border.EmptyBorder;

public class PremiereFenetre extends JFrame implements ActionListener {

	private JPanel contentPane;
	private JButton btnOk;
	private JTextField txtNom;
	private JLabel lblSaisirVotreNom;
	private JLabel lblFond;

	/**
	 * Launch the application.
	 */
	public static void main(String[] args) {
		EventQueue.invokeLater(new Runnable() {
			public void run() {
				try {
					PremiereFenetre frame = new PremiereFenetre();
					frame.setVisible(true);
				} catch (Exception e) {
					e.printStackTrace();
				}
			}
		});
	}

	/**
	 * Create the frame.
	 */
	public PremiereFenetre() {
		setTitle("Premi\u00E8re Fen\u00EAtre");
		setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
		setBounds(100, 100, 450, 300);
		this.contentPane = new JPanel();
		this.contentPane.setBorder(new EmptyBorder(5, 5, 5, 5));
		setContentPane(this.contentPane);
		this.contentPane.setLayout(null);
		
		this.btnOk = new JButton("Ok");
		this.btnOk.addActionListener(this);
		this.btnOk.setBounds(172, 186, 89, 23);
		this.contentPane.add(this.btnOk);
		
		this.txtNom = new JTextField();
		this.txtNom.setBounds(131, 81, 181, 23);
		this.contentPane.add(this.txtNom);
		this.txtNom.setColumns(10);
		
		this.lblSaisirVotreNom = new JLabel("Saisir votre nom");
		this.lblSaisirVotreNom.setFont(new Font("Times New Roman", Font.PLAIN, 16));
		this.lblSaisirVotreNom.setBounds(130, 33, 181, 23);
		this.contentPane.add(this.lblSaisirVotreNom);
		
		this.lblFond = new JLabel("");
		this.lblFond.setIcon(new ImageIcon(PremiereFenetre.class.getResource("/images/fond2.png")));
		this.lblFond.setBounds(0, 0, 434, 262);
		this.contentPane.add(this.lblFond);
	}
	public void actionPerformed(ActionEvent arg0) {
		JOptionPane.showMessageDialog(this, "Bienvenue "+this.txtNom.getText());
	}
}
